package com.example.wordpress;

import com.facebook.widget.ProfilePictureView;

import android.app.Activity;
import android.content.Context;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;

public class LoginView extends View {

	private final Activity activity;
	
	private final TextView msjFB;
	private final Button authButton;
	private final TextView userName;
	private final ProfilePictureView userPhoto;
	
	public LoginView(Context a) {
		super(a);
		activity = (Activity) a;
		activity.setContentView(R.layout.activity_world_press_for_facebook);
		
		msjFB = (TextView) activity.findViewById(R.id.msjFB);
		authButton = (Button) activity.findViewById(R.id.authButton);
		//authButton.setVisibility(2);
		authButton.setEnabled(false);
		userName = (TextView) activity.findViewById(R.id.userName);
		userPhoto = (ProfilePictureView) activity.findViewById(R.id.userPhoto);
		userPhoto.setCropped(true);
	}
	
	public void setTag(String tag) {
		authButton.setText(tag);
	}
	
	public void setAuthButtonVisibility(int valor) {
		if (valor == 0) {
			authButton.setVisibility(View.VISIBLE);
		} else if (valor == 1) {
			authButton.setVisibility(View.INVISIBLE);
		} else if (valor == 2) {
			authButton.setVisibility(View.GONE);
		}
	}
	
	public void setAuthButtonEnabled(boolean valor) {
		if (valor == true) {
			authButton.setEnabled(true);
		} else {
			authButton.setEnabled(false);
		}
	}
	
	public void setMsjFB(String msj) {
		msjFB.setText(msj);
	}
	
	public void setUserName(String user) {
		userName.setText(user);
	}
	
	public ProfilePictureView getUserPhoto() {
		return userPhoto;
	}
}